<template>
	<web-view class="web-view" :webview-styles="webviewStyles" :src="url" :style="{width: windowW + 'px', height: windowH + 'px'}"></web-view>
</template>

<script>
	import $store from "@/store";
	export default {
		data() {
			return {
				windowH: 0,
				windowW: 0,
				webviewStyles: {
					progress: {
						color: 'transparent'
					}
				},
				url: ''
			}
		},
		onLoad(option) {
			if(option.q){this.url = decodeURIComponent(option.q+"&_SESSION_="+$store.state.app.token);}
			
			if(option.url){
				if(decodeURIComponent(option.url).indexOf("?") != -1){
					this.url = decodeURIComponent(option.url+"&_SESSION_="+$store.state.app.token);
				}else{
					this.url = decodeURIComponent(option.url+"?_SESSION_="+$store.state.app.token);					
				}			
				
			}
			console.log(this.url);
			try {
				const res = uni.getSystemInfoSync();
				this.windowW = res.windowWidth;
				this.windowH = res.windowHeight;
			} catch (e) {
				// error
			}
		}
	}
</script>
